package com.web_bloks.project.client;

import com.web_bloks.content.client.ViewManager;
import com.web_bloks.document.client.Title;
import com.web_bloks.document.client.TitleException;
import com.web_bloks.document.client.NamespaceException;
//PAGES
import com.web_bloks.project.pages.client.MainPage;
import com.web_bloks.project.pages.client.EditPage;

/**
 * 
 * @author Jean-Lou Dupont
 *
 */
public class AppViewManager extends ViewManager {

	static Title wildTitle = null;
	
	//Titles
	Title editPageTitle = null;
	
	protected AppViewManager() {
		super();
		setup();
		init();
	}
	
	protected void setup() {
		wildTitle = Title.newWild();
		
		Exception e = null;
		
		try {
			editPageTitle = Title.newFromText("Edit");
		} catch(TitleException te) {
			e = te;
		} catch(NamespaceException ne) {
			e = ne;
		}
		if (e!=null)
			throw new RuntimeException(getClass()+".setup, msg="+e.getMessage());
	}
	
	/**
	 * 
	 */
	protected void init() {
		
		addMapping( editPageTitle,	new EditPage() );
		addMapping( wildTitle, 		new MainPage() );
		
	}
	
}//END